package com.java46.front.dessert.entity;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

@Entity
@Table(name = "dessert", schema = "dessertdb")
public class DessertEntity {
    private int dessertId;
    private String dessertName;
    private String dessertIcon;
    private double dessertPrice;
    private String desertMark;
    private Integer dessertSum;
    private Integer dessertCount;
    private int dessertType;

    @Id
    @Column(name = "dessertId")
    @GenericGenerator(name = "dessert_auto",strategy = "increment")
    @GeneratedValue(generator = "dessert_auto")
    public int getDessertId() {
        return dessertId;
    }

    public void setDessertId(int dessertId) {
        this.dessertId = dessertId;
    }

    @Basic
    @Column(name = "dessertName")
    public String getDessertName() {
        return dessertName;
    }

    public void setDessertName(String dessertName) {
        this.dessertName = dessertName;
    }

    @Basic
    @Column(name = "dessertIcon")
    public String getDessertIcon() {
        return dessertIcon;
    }

    public void setDessertIcon(String dessertIcon) {
        this.dessertIcon = dessertIcon;
    }

    @Basic
    @Column(name = "dessertPrice")
    public double getDessertPrice() {
        return dessertPrice;
    }

    public void setDessertPrice(double dessertPrice) {
        this.dessertPrice = dessertPrice;
    }

    @Basic
    @Column(name = "desertMark")
    public String getDesertMark() {
        return desertMark;
    }

    public void setDesertMark(String desertMark) {
        this.desertMark = desertMark;
    }

    @Basic
    @Column(name = "dessertSum")
    public Integer getDessertSum() {
        return dessertSum;
    }

    public void setDessertSum(Integer dessertSum) {
        this.dessertSum = dessertSum;
    }

    @Basic
    @Column(name = "dessertCount")
    public Integer getDessertCount() {
        return dessertCount;
    }

    public void setDessertCount(Integer dessertCount) {
        this.dessertCount = dessertCount;
    }

    @Basic
    @Column(name = "dessertType")
    public int getDessertType() {
        return dessertType;
    }

    public void setDessertType(int dessertType) {
        this.dessertType = dessertType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DessertEntity that = (DessertEntity) o;

        if (dessertId != that.dessertId) return false;
        if (Double.compare(that.dessertPrice, dessertPrice) != 0) return false;
        if (dessertType != that.dessertType) return false;
        if (dessertName != null ? !dessertName.equals(that.dessertName) : that.dessertName != null) return false;
        if (dessertIcon != null ? !dessertIcon.equals(that.dessertIcon) : that.dessertIcon != null) return false;
        if (desertMark != null ? !desertMark.equals(that.desertMark) : that.desertMark != null) return false;
        if (dessertSum != null ? !dessertSum.equals(that.dessertSum) : that.dessertSum != null) return false;
        if (dessertCount != null ? !dessertCount.equals(that.dessertCount) : that.dessertCount != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result;
        long temp;
        result = dessertId;
        result = 31 * result + (dessertName != null ? dessertName.hashCode() : 0);
        result = 31 * result + (dessertIcon != null ? dessertIcon.hashCode() : 0);
        temp = Double.doubleToLongBits(dessertPrice);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (desertMark != null ? desertMark.hashCode() : 0);
        result = 31 * result + (dessertSum != null ? dessertSum.hashCode() : 0);
        result = 31 * result + (dessertCount != null ? dessertCount.hashCode() : 0);
        result = 31 * result + dessertType;
        return result;
    }
}
